Skip to content

Move timezone settings into autoload file#22623

Merged
timroes merged 6 commits intoelastic:masterfrom
timroes:autoload-timezone
Sep 5, 2018
Merged

Move timezone settings into autoload file#22623
timroes merged 6 commits intoelastic:masterfrom
timroes:autoload-timezone

Conversation

@timroes
Copy link
Copy Markdown
Contributor

@timroes timroes commented Sep 3, 2018

Until now we loaded the dateFormat:tz and dateFormat:dow setting via the KibanaRootController, which will be applied using chrome.setRootController. That has the huge disadvantage, that every app plugin won't have that setting applied and would need to manually apply it to moment.

I moved that behavior to a new autoload/setting file, which is also included into autoload/all. That way every app plugin that includes ui/autoload/setting or ui/autoload/all will automatically have those settings.

I found this issue, while writing functional plugin tests for the visualize loader API (see #22595), and seeing that no timezone is applied when embedding visualizations. I think using an autoload file is the better solution that requiring every app plugin to do exactly the same by itself (or like the dashboard only plugin, even import controllers from the kibana plugin).

For QA: This PR should not change any behavior in Kibana, all time zone settings should still work as beforehand.

CC:

  • @walterra I removed setting it manually from ML, could you please validate everything still working
  • @chrisronline I've removed the previous manual set from monitoring, could you please validate everything's still working

Dev Docs

Time zone in application plugins

If you are using import 'ui/autoload/all'; in your application plugin (or import 'ui/autoload/settings'; directly) the timezone and start of the week configured in Kibana will now correctly be set to moment and thus be used by Kibana core services, like the visualize loader API to embed visualizations.

@timroes timroes added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v7.0.0 v6.5.0 release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. labels Sep 3, 2018
Copy link
Copy Markdown
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM. Good to merge after CI pass

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@timroes
Copy link
Copy Markdown
Contributor Author

timroes commented Sep 3, 2018

Retest

Copy link
Copy Markdown
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I tested the code change regarding ML and the timezone gets still picked up correctly!

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@ppisljar
Copy link
Copy Markdown
Contributor

ppisljar commented Sep 3, 2018

retest

Copy link
Copy Markdown
Contributor

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM after CI goes green

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but, if possible, please add a couple of jest tests for the new autoload/settings.js to make sure we correctly set initial and changed values.

During testing I've also noticed one weird thing: by default uiSettings.get('dateFormat:tz') returns Browser string that we pass directly to moment.tz.setDefault(...) that doesn't feel right even though it may work as expected right now, once we change timezone to some non-default value and then reset back to Browser, subscribers will be notified with null value instead of Browser string. Just observation, not sure if it's something we should take care of right now 🤷‍♂️

Copy link
Copy Markdown
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I messed around with absolute times in monitoring UI and didn't see any regressions

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@timroes
Copy link
Copy Markdown
Contributor Author

timroes commented Sep 4, 2018

Jenkins, test this - And ES build failure once again

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@spalger
Copy link
Copy Markdown
Contributor

spalger commented Sep 4, 2018

retest

Copy link
Copy Markdown
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, created #22668 to deal with the weirdness spotted by @azasypkin upstream.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@timroes timroes merged commit 5f4a1c5 into elastic:master Sep 5, 2018
@timroes timroes deleted the autoload-timezone branch September 5, 2018 06:55
timroes added a commit to timroes/kibana that referenced this pull request Sep 5, 2018
* Move timezone settings into autoload file

* Remove applying setting from timelion

* Remove manual set from ML

* Remove manual set from monitoring

* Remove now obsolete code from embedding test plugin
timroes added a commit that referenced this pull request Sep 5, 2018
* Move timezone settings into autoload file

* Remove applying setting from timelion

* Remove manual set from ML

* Remove manual set from monitoring

* Remove now obsolete code from embedding test plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v6.5.0 v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants